// pages/bindingGuild/President/platform/platform.js
const app=getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    platfroms:null,//循环
    process_flag:null,//跳转标志
  },
  back_bind:function(e){
    console.log(e.currentTarget.dataset)
    let p_id = e.currentTarget.dataset.id;
    let p_name = e.currentTarget.dataset.name;
    let p_is_paltfrom = e.currentTarget.dataset.is_paltfrom;
    let p_table_flag = e.currentTarget.dataset.table_flag;
    switch (this.data.process_flag){
      case "president_bind":
        wx.redirectTo({
          url: '../President/binding/binding?p_id=' + p_id + '&&p_name=' + p_name + '&&p_is_paltfrom=' + p_is_paltfrom + '&&p_table_flag=' + p_table_flag,
        })
      break;

      case "president_auth":
        wx.redirectTo({
          url: '../President/authenticate/authenticate?p_id=' + p_id + '&&p_name=' + p_name + '&&p_is_paltfrom=' + p_is_paltfrom,
        })
      break;

      case "anchor_bind":
        wx.redirectTo({
          url: '../anchor/binding/binding?p_id=' + p_id + '&&p_name=' + p_name + '&&p_is_paltfrom=' + p_is_paltfrom + '&&p_table_flag=' + p_table_flag,
        })
        break;
    }




    // if (this.data.process_flag=="bind"){
    //   wx.redirectTo({
    //     url: '../binding/binding?p_id=' + p_id + '&&p_name=' + p_name + '&&p_is_paltfrom=' + p_is_paltfrom + '&&p_table_flag=' + p_table_flag,
    //   })
    // } else if (this.data.process_flag=="auth"){
    //   wx.redirectTo({
    //     url: '../authenticate/authenticate?p_id=' + p_id + '&&p_name=' + p_name + '&&p_is_paltfrom=' + p_is_paltfrom ,
    //   })
    // }else{}
    
  },
  

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log(options)
    this.setData({
      process_flag: options.process_flag,
      role: app.register_info.register_role,
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    const that=this;
    wx.request({
      method:'POST',
      url: app.globalData.url +'api/common/select/quick/platfrom',
      data:{
        token:app.globalData.token,
      },
      success:function(e){
        console.log(e.data.data.platfroms)
        let platfroms = e.data.data.platfroms;
        that.setData({
          platfroms: platfroms
        })
      }
    })
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})